<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?>
<title><?= $sf_response->getTitle() ?></title>
<?php use_stylesheet('/sf/sf_admin/css/main') ?>
<div id="sf_admin_container">
<? if ($mod =='MR'){
?>
<h1>MR List</h1>
<div id="sf_admin_content">
<table id ='added_components' "cellspacing="0" class="sf_admin_list">
<thead>
<tr>
      <th id="sf_admin_list_th_productcode" >MR Number</th>      
      <th id="sf_admin_list_th_description" >Project</th>       
      <th id="sf_admin_list_th_description" >Sale Number</th>      
      <th id="sf_admin_list_th_description">Category</th>
      <th id="sf_admin_list_th_description">Require Arrival Date</th>
      <th id="sf_admin_list_th_description">Created At</th>
      <th id="sf_admin_list_th_description">Comp List</th>
      <th id="sf_admin_list_th_description">Status</th>
      <th id="sf_admin_list_th_description">Approval Status</th>
      <th id="sf_admin_list_th_description">Action</th>
</tr>
</thead>
<!--show component here-->
<?php  
    foreach ($mrList as $key=>$mr) { ?>        
        <tr class="sf_admin_row_<?php echo $key%2?>">
                <td><?php echo $mr->getMrno() ?></td>                
                  <td><?php echo $mr->getProject() ?></td>
                  <td><?php echo $mr->getSaleno() ?></td>
                  <td><?php echo CommonValues::$gMRCategory['value'][$mr->getCategory()] ?></td>
                  <td><?php echo ($mr->getReqarrdate() !== null && $mr->getReqarrdate() !== '') ? format_date($mr->getReqarrdate(), "D") : '' ?></td>
                  <td><?php echo ($mr->getCreatedAt() !== null && $mr->getCreatedAt() !== '') ? format_date($mr->getCreatedAt(), "D") : '' ?></td>
                  <td><?php echo link_to($mr->getComponentgroupId() ? image_tag('/sf/sf_admin/images/list.png', array('alt' => 'List', 'title' => 'List')):  __('-'), 'component/SLListModuleGroup?componentgroup_id='.$mr->getComponentgroupId().'&Authentication=VIEW_MR&titleqty=Qty To Request&titleqty4=Qty Outstanding&backURL=po~1SLListJobPurchaser~2mod~4MR') ?></td>
                  <td><?php echo CommonValues::$gMRStatus['value'][$mr->getStatus()] ?></td>
                  <td><?php echo CommonValues::$gMRApprovalStatus['value'][$mr->getApprovalstatus()]  ?></td>
                  <td><?php echo link_to(image_tag('/sf/sf_admin/images/add.png', array('alt' =>'create PO', 'title' => 'Create PO')), 'po/create?mr_id='.$mr->getId());  ?></td>     
        </tr>
<?php } ?>
</table>
<!--show component here-->
<?} elseif ($mod =='MR2'){?>
<h1>MR Sub List</h1>
<div id="sf_admin_content">
<table id ='added_components' "cellspacing="0" class="sf_admin_list">
<thead>
<tr>
      <th id="sf_admin_list_th_productcode" >MR Number</th>      
      <th id="sf_admin_list_th_description" >Project</th>       
      <th id="sf_admin_list_th_description" >Sale Number</th>      
      <th id="sf_admin_list_th_description">Category</th>
      <th id="sf_admin_list_th_description">Require Arrival Date</th>
      <th id="sf_admin_list_th_description">Created At</th>
      <th id="sf_admin_list_th_description">Comp List</th>
      <th id="sf_admin_list_th_description">Status</th>
      <th id="sf_admin_list_th_description">Approval Status</th>
      <th id="sf_admin_list_th_description">Action</th>
</tr>
</thead>
<?php  
    foreach ($mr2List as $key=>$mr2) { ?>        
        <tr class="sf_admin_row_<?php echo $key%2?>">
                    <td><?php echo link_to($mr2->getMrno() ? $mr2->getMrno() : __('-'), 'mr2/edit?id='.$mr2->getId()) ?></td>
                    <td><?php echo $mr2->getProject() ?></td>
                      <td><?php echo $mr2->getSaleno() ?></td>
                      <td><?php echo CommonValues::$gMRCategory['value'][$mr2->getCategory()] ?></td>
                      <td><?php echo ($mr2->getReqarrdate() !== null && $mr2->getReqarrdate() !== '') ? format_date($mr2->getReqarrdate(), "D") : '' ?></td>
                      <td><?php echo ($mr2->getCreatedAt() !== null && $mr2->getCreatedAt() !== '') ? format_date($mr2->getCreatedAt(), "D") : '' ?></td>
                      <td><?php echo link_to($mr2->getComponentgroupId() ? image_tag('/sf/sf_admin/images/list.png', array('alt' => 'List', 'title' => 'List')):  __('-'), 'component/SLListModuleGroup?componentgroup_id='.$mr2->getComponentgroupId().'&Authentication=VIEW_MRSUB&titleqty=Qty To Request&titleqty4=Qty Outstanding&backURL=po~1SLListJobPurchaser~2mod~4MR2') ?></td>
                      <td><?php echo CommonValues::$gMRStatus['value'][$mr2->getStatus()] ?></td>
                      <td><?php echo CommonValues::$gMRApprovalStatus['value'][$mr2->getApprovalstatus()]  ?></td>
                      <td><?php echo link_to(image_tag('/sf/sf_admin/images/' . 'add.png', array('alt' =>'create PO', 'title' => 'Create PO')), 'po/create?mr2_id='.$mr2->getId());  ?></td>               
                
        </tr>
<?php } ?>

</table>
<!--show component here-->
<?} else {?>
<h1>MR Raw List</h1>
<div id="sf_admin_content">
<table id ='added_components' "cellspacing="0" class="sf_admin_list">
<thead>
<tr>
      <th id="sf_admin_list_th_productcode" >MR Number</th>      
      <th id="sf_admin_list_th_description">Category</th>
      <th id="sf_admin_list_th_description">Require Arrival Date</th>
      <th id="sf_admin_list_th_description">Created At</th>
      <th id="sf_admin_list_th_description">Comp List</th>
      <th id="sf_admin_list_th_description">Status</th>
      <th id="sf_admin_list_th_description">Approval Status</th>
      <th id="sf_admin_list_th_description">Action</th>
</tr>
</thead>
<!--show component here-->
<?php  
    foreach ($mr3List as $key=>$mr3) { ?>        
        <tr class="sf_admin_row_<?php echo $key%2?>">
                    <td><?php echo link_to($mr3->getMrno() ? $mr3->getMrno() : __('-'), 'mr3/edit?id='.$mr3->getId()) ?></td>
                    <td><?php echo CommonValues::$gMRCategory['value'][$mr3->getCategory()] ?></td>
                      <td><?php echo ($mr3->getReqarrdate() !== null && $mr3->getReqarrdate() !== '') ? format_date($mr3->getReqarrdate(), "D") : '' ?></td>
                      <td><?php echo ($mr3->getCreatedAt() !== null && $mr3->getCreatedAt() !== '') ? format_date($mr3->getCreatedAt(), "D") : '' ?></td>
                      <td><?php echo link_to($mr3->getComponentgroupId() ? image_tag('/sf/sf_admin/images/list.png', array('alt' => 'List', 'title' => 'List')):  __('-'), 'component/SLListModuleGroup?componentgroup_id='.$mr3->getComponentgroupId().'&Authentication=VIEW_MRRAW&titleqty=Qty To Request&titleqty4=Qty Outstanding&backURL=po~1SLListJobPurchaser~2mod~4MR3') ?></td>
                      <td><?php echo CommonValues::$gMRStatus['value'][$mr3->getStatus()] ?></td>
                      <td><?php echo CommonValues::$gMRApprovalStatus['value'][$mr3->getApprovalstatus()] ?></td>
                      <td><?php echo link_to(image_tag('/sf/sf_admin/images/' . 'add.png', array('alt' =>'create PO', 'title' => 'Create PO')), 'po/create?mr3_id='.$mr3->getId());  ?></td>                                
        </tr>
<?php } ?>
</table>
<?}?>

</div>
</div>